#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QPropertyAnimation>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    animation = new QPropertyAnimation(ui->pushButton, "geometry");
    animation->setDuration(30 * 1000);
    animation->setStartValue(QRect(0, 0, 50, 50));
    animation->setEndValue(QRect(300, 200, 100, 100));
    animation->setLoopCount(3);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_2_clicked()
{
    animation->start();
}

void MainWindow::on_pushButton_3_clicked()
{
    animation->pause();
}

void MainWindow::on_pushButton_4_clicked()
{
    animation->stop();
}

void MainWindow::on_pushButton_5_clicked()
{
    animation->resume();
}

void MainWindow::on_pushButton_6_clicked()
{
    animation->setEasingCurve(QEasingCurve::Linear);
}

void MainWindow::on_pushButton_7_clicked()
{
    animation->setEasingCurve(QEasingCurve::InQuad);
}

void MainWindow::on_pushButton_8_clicked()
{
    animation->setEasingCurve(QEasingCurve::InCubic);
}

void MainWindow::on_pushButton_9_clicked()
{
    animation->setEasingCurve(QEasingCurve::InOutBounce);

}
